package com.ruoyi.web.controller.kiku;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.kiku.domain.KikuTokenConfig;
import com.ruoyi.kiku.service.IKikuTokenConfigService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 平台的cookie信息Controller
 *
 * @author TT
 * @date 2025-08-23
 */
@RestController
@RequestMapping("/kiku/ptconfig")
public class KikuTokenConfigController extends BaseController
{
    @Autowired
    private IKikuTokenConfigService kikuTokenConfigService;

    /**
     * 查询平台的cookie信息列表
     */
    @PreAuthorize("@ss.hasPermi('kiku:ptconfig:list')")
    @GetMapping("/list")
    public TableDataInfo list(KikuTokenConfig kikuTokenConfig)
    {
        startPage();
        List<KikuTokenConfig> list = kikuTokenConfigService.selectKikuTokenConfigList(kikuTokenConfig);
        return getDataTable(list);
    }

    /**
     * 导出平台的cookie信息列表
     */
    @PreAuthorize("@ss.hasPermi('kiku:ptconfig:export')")
    @Log(title = "平台的cookie信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, KikuTokenConfig kikuTokenConfig)
    {
        List<KikuTokenConfig> list = kikuTokenConfigService.selectKikuTokenConfigList(kikuTokenConfig);
        ExcelUtil<KikuTokenConfig> util = new ExcelUtil<KikuTokenConfig>(KikuTokenConfig.class);
        util.exportExcel(response, list, "平台的cookie信息数据");
    }

    /**
     * 获取平台的cookie信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:ptconfig:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(kikuTokenConfigService.selectKikuTokenConfigById(id));
    }

    /**
     * 新增平台的cookie信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:ptconfig:add')")
    @Log(title = "平台的cookie信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody KikuTokenConfig kikuTokenConfig)
    {
        return toAjax(kikuTokenConfigService.insertKikuTokenConfig(kikuTokenConfig));
    }

    /**
     * 修改平台的cookie信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:ptconfig:edit')")
    @Log(title = "平台的cookie信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody KikuTokenConfig kikuTokenConfig)
    {
        return toAjax(kikuTokenConfigService.updateKikuTokenConfig(kikuTokenConfig));
    }

    /**
     * 删除平台的cookie信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:ptconfig:remove')")
    @Log(title = "平台的cookie信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(kikuTokenConfigService.deleteKikuTokenConfigByIds(ids));
    }
}
